<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
<%@ include file="/jsp/commons/path.jsp"%>
<%@ include file="/jsp/commons/head.jsp"%>
<%@ include file="/jsp/commons/easyui.jsp"%>
<script type="text/javascript">

function loginOut() {
	 
	 
	
	$.ajaxEx({
		type : 'post',
		url : '${ctx}/login/loginOut.do',
		data : {
		},
		dataType : 'json',
		success : function(data) {
			var result = data.result;
			if(result == 'success') {
					window.location.href = '${ctx}/login/noLogin.do';
					} else {
						$.messager.alert('提示', '操作失败！<br />' + data.error, 'error');
					}
		},
		error : ajaxError
	});
}
</script>
</head>
<body>

欢迎${user.userId}登录
<shiro:hasRole name="admin">
<a href="<c:url value='/admin/role'/>"><button>访问需要角色的页面</button></a>
</shiro:hasRole>

<a href="<c:url value='/admin/auth'/>"><button>访问需要权限的页面</button></a>

<a href="#" onclick="loginOut()"><button>退出登录</button></a>


<shiro:hasRole name="admin">
    <a href="user/show">查看用户</a><br>
    <a href="user/create">创建用户</a>
</shiro:hasRole>

<shiro:hasRole name="user">
<a href="user/show">查看用户</a>
</shiro:hasRole>

<shiro:hasPermission name="user:create">
     <a href="admin.jsp">创建用户</a>
</shiro:hasPermission>


</body>
</html>